﻿CREATE PROCEDURE [dbo].[proc_Project_Task_Getlist_ByOrder]
	(
		@OId uniqueidentifier
	)
AS
begin
Select id
,TaskId
,Title
		,DownPersonName
		,ExecPersonName
,(Case When Project_Task.[ExecPerson]='' then [ExecDepartmentName] Else (Select Top 1 ZhiWu From Employee e Where UserName=Project_Task.[ExecPerson]) End) As Description		--执行人的职务
		,StartDate
		,ISNULL(EndDate,'1900-01-01') As EndDate
		,datediff(day,StartDate,ISNULL(EndDate,GetDate())) As CountDay
		,IsFinish
		From Project_Task
		Where OrderId=@OId
End
	RETURN
